package net.zoneland.knowledge.service.impl;

import net.zoneland.knowledge.dao.AttachmentPreviewMapper;
import net.zoneland.knowledge.model.*;
import net.zoneland.knowledge.service.PreviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * .
 *
 * @author: bcc
 * 2021/6/9
 */
@Service
public class PreviewServiceImpl implements PreviewService {

    @Autowired
    private AttachmentPreviewMapper previewMapper;


    /**
     * 从数据库加载附件信息.
     *
     * @param id
     * @return
     */
    @Override
    public AttachmentPreviewForm queryById(final String id) {
        return previewMapper.selectByPrimaryKey(id);
    }

    /**
     * 更新临时附件信息状态
     *
     * @param form
     * @return
     */
    @Override
    public int update(final AttachmentPreviewForm form) {
        return previewMapper.updateByPrimaryKey(form);
    }

    /**
     * 存储附件临时信息.
     *
     * @param form
     * @return
     */
    @Override
    public int insert(final AttachmentPreviewForm form) {
        return previewMapper.insert(form);
    }
}
